home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / flight-of-the-museum.swf / scripts / ui / SwearWordTester.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.3 KB  |  45 lines

  1. package ui
  2. {
  3.    public class SwearWordTester
  4.    {
  5.       
  6.       private static var isBadword:int;
  7.       
  8.       private static var isLegal:Boolean;
  9.       
  10.       private static var testWordLC:String;
  11.       
  12.       private static var si:int;
  13.       
  14.       private static var swearwordList:Array = new Array("co ck","c unt","cu nt","fu ck","f uck","fuk","fuc","cnt","knt","ass","dic","fag","d1k","4q","cun","pis","nig","gay","fu","as5","a55","p1s","fu2","BJ","BJU","bum","cok","cum","tit","t1t","coc","koc","f4g","c0k","c0c","twt","pus","dyk","tlt","sac","sak","s4c","s4k","arse","fuck","shit","cunt");
  15.       
  16.       private static var swearWord:String;
  17.        
  18.       
  19.       public function SwearWordTester()
  20.       {
  21.          super();
  22.       }
  23.       
  24.       public static function testWordForErrors(testWord:String) : Boolean
  25.       {
  26.          if(testWord.length < 1)
  27.          {
  28.             trace("word not long enough");
  29.             return false;
  30.          }
  31.          for(si = 0; si < swearwordList.length; ++si)
  32.          {
  33.             swearWord = swearwordList[si];
  34.             testWordLC = testWord.toLowerCase();
  35.             isBadword = testWordLC.indexOf(swearWord);
  36.             if(isBadword != -1)
  37.             {
  38.                return false;
  39.             }
  40.          }
  41.          return true;
  42.       }
  43.    }
  44. }
  45.